{template header_seller}
<div id="mainFrame">
	<div class="seller-tab-bar">
    	<div class="item"><a href="/?m=$G[m]&c=$G[c]&a=showlist">商品列表</a></div>
        <div class="item{if $G[a]=='publish'} on{/if}"><a href="/?m=$G[m]&c=$G[c]&a=publish">发布商品</a></div>
        {if $G[a]=='edit'}<div class="item on"><a href="">编辑商品</a></div>{/if}
        
        <div class="item"><a href="/?m=$G[m]&c=sold">订单管理</a></div>
        <div class="item"><a href="/?m=$G[m]&c=ticket">返券管理</a></div>
    </div>
    <div class="blank"></div>
    <div class="tableView">
      <form method="post" id="goodsForm" autocomplete="off">
      <input type="hidden" name="formsubmit" value="yes">
      <input type="hidden" name="formhash" value="{FORMHASH}">
      <input type="hidden" name="goodsnew[shopid]" value="$shop[shopid]">
      <div class="row">
          <div class="cell cell-name">商品名称</div>
          <div class="cell cell-input"><input type="text" class="input-text" maxlength="60"  name="goodsnew[name]" value="$goods[name]" id="goodsname"></div>
          <div class="cell error" id="tips_name">请填写商品名称，至少2个字</div>
      </div>
      
      <div class="row">
          <div class="cell cell-name">商品类目</div>
          <div class="cell cell-content">
          	  {eval $categorylist=category_get_tree('goods');}
              <select id="cat1" class="input-select" id="catid" size="5" style="height:120px; width:150px; margin-right:10px;">
              <option value="0">请选择类目</option>
              {loop $categorylist[0] $c}
              <option value="$c[catid]">$c[cname]</option>
              {/loop}
              </select>
              <select id="cat2" class="input-select" id="catid" size="5" style="height:120px; width:150px; margin-right:10px;">
              </select>
              <select name="goodsnew[catid]" id="cat3" class="input-select" id="catid" size="5" style="height:120px; width:150px;">
              </select>
          </div>
          <div class="cell error" id="tips_catid">请选择商品类目</div>
      </div>
      
      <div class="row">
          <div class="cell cell-name">商品价格</div>
          <div class="cell">
          	<input type="text" class="input-text w120" name="goodsnew[price]" value="$goods[price]" id="price"></div>
          <div class="cell cell-name">商品库存</div>
          <div class="cell">
          	<input type="text" class="input-text w120" name="goodsnew[stock]" value="$goods[stock]" id="stock"></div>
          <div class="cell error" id="tips_stock">请填写商品库存</div>
          <div class="cell error" id="tips_price">请填写商品价格</div>
      </div>
      
       <div class="row">
          <div class="cell cell-name">是否折扣</div>
          <div class="cell w120">
          	<label><input type="radio" class="radio" name="goodsnew[isdiscount]" value="1"{if $goods[isdiscount]} checked{/if}> 是</label>
          	<label><input type="radio" class="radio" name="goodsnew[isdiscount]" value="0"{if !$goods[isdiscount]} checked{/if}> 否</label>
          </div>
          <div class="cell cell-name">折扣价格</div>
          <div class="cell">
          	<input type="text" class="input-text w120" name="goodsnew[discount_price]" value="$goods[discount_price]" id="discount_price"></div>
      </div>
      
      <div class="row">
          <div class="cell cell-name">返现金额</div>
          <div class="cell cell-input">
          	<input type="text" class="input-text w100" maxlength="60"  name="goodsnew[back_amount]" value="$goods[back_amount]" id="back_amount"></div>
          <div class="cell error" id="tips_amount">请填写返现金额</div>
      </div>
      <div class="blank"></div>
      <div class="row">	 
          <div class="cell cell-name">商品图片</div>
          <div class="cell">
            <div id="imageUploadQueue">
                {loop $piclist $plist}
                <div class="imageUploadItem"><img src="{$plist[thumburl]}">
                    <input type="hidden" name="piclist[{$plist[id]}][image]" value="{$plist[image]}">
                    <input type="hidden" name="piclist[{$plist[id]}][thumb]" value="{$plist[thumb]}">
                    <a class="icon del" href="javascript:;" title="删除" onclick="$(this).parent().remove();">&#xf00b3;</a>
                </div>
                {/loop}
                <div class="selectImageButton" id="selectImageButton"><a href="javascript:;">添加图片</a></div>
            </div>
          </div>
      </div>
      <div class="blank"></div>
      <div class="row">
      	  {eval $editorname='description';}
          {eval $editorcontent=$description[description];}
          <div class="cell cell-name">商品描述</div>
          <div class="cell">{template editor_mini}</div>
      </div>
      <div class="row">
          <div class="cell cell-name">&nbsp;</div>
          <div class="cell"><input type="submit" class="button" value="提交"></div>
      </div>
      </form>
    </div>
</div>
<form id="uploadForm" method="post" enctype="multipart/form-data" action="/?m=common&c=upload&a=uploadimage">
<input name="filedata" id="filedata" type="file" title="选择商品图片" class="j-filedata">
</form>
<script type="text/javascript">var categoryoptions={echo json_encode($categorylist);};</script>
<script src="/static/js/goos_pub.js"></script>
{template footer_seller}